package com.moto.service.impl;

import com.moto.entity.Address;
import com.moto.entityDto.AddressUpdateDto;
import com.moto.mapper.AddressMapper;
import com.moto.service.IAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hyf
 * @since 2023-09-04
 */
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {

    @Autowired
    private AddressMapper addressMapper;
    @Override
    public void addAddress(Address address) {
        addressMapper.addAddress(address);
    }

    /**
     * 修改地址
     * @param addressUpdateDto
     */
    @Override
    public void updateAddressById(AddressUpdateDto addressUpdateDto) {
        addressMapper.updateAddressById(addressUpdateDto);
    }

    /**
     * 修改默认地址
     * @param id
     */
    @Override
    public void updateIsDefault(int id) {
        addressMapper.updateIsDefault(id);
    }


}
